﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace PainterControl
{
    public interface IPainter
    {

    }
    public interface IPainterMenu: IPainter
    {
        void AddMenu(StackPanel stackPannel);
    }
    public interface IPainterPannel : IPainter
    {
        string GetTitle();
        double GetWidth();
    }

    public static class ApplicationData
    {
        private static List<InkCanvas> mCanvas { get; set; }
        private static TabControl mTabControl { get; set; }

        public static void SetCanvas(List<InkCanvas> canvas){ mCanvas = canvas;}
        public static void SetTabControl(TabControl tabControl){ mTabControl = tabControl;}
        public static void AddSplite()
        {
            foreach (TabItem it in mTabControl.Items)
            {
                if (it.Name == "插件")
                {
                    (it.Content as StackPanel).Children.Add(new Border() {
                        BorderBrush =Brushes.Black,BorderThickness=new Thickness(1),
                        Height = (it.Content as StackPanel).ActualHeight,Width=1 });
                    break;
                }
            }
        }
        public static void AddMenu(ImageSource image,string text, MouseButtonEventHandler click_event)
        {
            foreach(TabItem it in mTabControl.Items)
            {
                if(it.Name == "插件")
                {
                    StackPanel stack = new StackPanel() { Orientation = Orientation.Vertical };
                    stack.Children.Add(new Image() { Width = 80, Height = 50,Source = image });
                    stack.Children.Add(new TextBlock() { Text = text, HorizontalAlignment = HorizontalAlignment.Center });
                    (it.Content as StackPanel).Children.Add(stack);
                    stack.MouseUp += click_event;
                    break;
                }
            }
        }
    }
}
